package com.qf.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DomainController {

    @Value("${server.port}")
    private String port;

    @GetMapping("/hello")
//    @CrossOrigin("http://localhost:9901")
    @CrossOrigin("*") // 自动给响应头中设置Access-Control-Allow-Origin
    public String hello(String callback) {
        System.out.println("DomainController.hello:"+port);

        // abc('Hello:9902')
        System.out.println(callback);
        return callback +"('"+"hello:"+port+"')";
    }
}
